import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class code1 {
    static List<int []> list = new ArrayList<>();
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        //枚举所有的质因子
        for (int i = 2; i < n/i; i++) {
            int ans = 0;
            while(n%i==0) {
                ans++;
                n/=i;
            }
            list.add(new int[] {i,ans});
        }
        if(n>1) {//如果n大于1表示还有一个质因子
            list.add(new int[] {n,1});
        }
        for(int[] x:list) {
            System.out.println(x[0]+" "+x[1]);
        }
    }
}
